//
//  BeanSettings.m
//  RtspClient
//
//  Created by qi tan on 2024/1/9.
//  Copyright © 2024 Andres Rojas. All rights reserved.
//

#import "BeanSettings.h"

@implementation BeanSettings

- (instancetype)initWithDict:(NSDictionary *)dict {
    if(self = [super init]) {
        //[self setValuesForKeysWithDictionary:dict];
        if([[dict allKeys] containsObject:@"units"]) {
            self.units = [dict[@"units"] intValue];
        }
        if([[dict allKeys] containsObject:@"sleepTimeSec"]) {
            self.sleepTimeSec = [dict[@"sleepTimeSec"] intValue];
        }
        if([[dict allKeys] containsObject:@"language"]) {
            self.language = [dict[@"language"] intValue];
        }
    }
    return self;
}

+ (instancetype)beanWithDict:(NSDictionary *)dict {
    return [[self alloc]initWithDict:dict];
}

- (NSString *)description {
    return [NSString stringWithFormat:@"BeanSettings---: units:%d, sleepTimeSec:%d, language:%d",
            self.units, self.sleepTimeSec, self.language];
}
@end
